package com.passion.domain.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.passion.base.AbstractMpEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import java.util.Date;

 /**
  * 【t_log_sql】表实体类;
  * 表备注：系统SQL执行记录表
  * @author ZhuYin<zyexplorej2ee@sina.com>
  * @since  2024年12月26日
  */
@ApiModel(value = "系统SQL执行记录表")
@EqualsAndHashCode(callSuper = false)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("t_log_sql")
public class LogSql extends AbstractMpEntity<LogSql, String> {

    /** 主键ID */
    @ApiModelProperty(name = "主键ID")
    @TableId
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "JDBC")
    private String id;
    
    /** SQL对应的键，即DAO层方法名 */
    @ApiModelProperty(name = "SQL对应的键，即DAO层方法名")
    private String sqlKey;
    
    /** SQL具体内容 */
    @ApiModelProperty(name = "SQL具体内容")
    private String sqlContent;
    
    /** SQL执行耗时 单位：毫秒 */
    @ApiModelProperty(name = "SQL执行耗时 单位：毫秒")
    private Long costTime;

     /** 触发执行SQL的用户ID */
     @ApiModelProperty(name = "触发执行SQL的用户ID")
    private String userId;
    
    /** SQL执行的时间 */
    @ApiModelProperty(name = "SQL执行的时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    
}
